<?php
/**
 * Created by PhpStorm.
 * User: 王松
 * Time: 2017/6/16 14:18
 */

namespace App\Transformers;

use App\Models\FamilyHistory;
use League\Fractal\TransformerAbstract;

class FamilyHistoryTransformer extends TransformerAbstract
{
    /**
     * @var \App\Project\FieldTranslation\FieldTranslation
     */
    protected $field;

    public function __construct()
    {
        $this->field = app('field')->get('weight');
    }

    /**
     * @param \App\Models\FamilyHistory $history
     * @return array
     */
    public function transform(FamilyHistory $history)
    {
        return [
            'id'             => $history->id,
            'record_id'      => $history->record_id,
            'diabetes'       => $history->diabetes,
            'hypertension'   => $history->hypertension,
            'chd'            => $history->chd,
            'embolism'       => $history->embolism,
            'hyperlipidemia' => $history->hyperlipidemia,
            'tumor'          => $history->tumor,
            'extend'         => $history->extend,
            'remark'         => $history->remark,
        ];
    }
}